package com.sino.second.struts2;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.sino.business.IBasicInfoService;
import com.sino.business.IStaticDataService;
import com.sino.second.bean.TblEmailset;
import com.sino.second.business.IEmailService;
import com.sino.util.CreatQueryCondition;
import com.sino.util.SysParameter;
import com.sino.util.page.PagerModel;

public class EmailSetAction extends ActionSupport {
	IEmailService  emailServiceImpl;//邮件发送
	private IStaticDataService staticDateService;// 基础数据
	private IBasicInfoService basicInfoService;// 基本信息
	private TblEmailset emailSet; //邮件设置
	private Integer emailSetId;  //邮件ID
	private String year;//年度;
	private PagerModel pm;
	private String queryWhere;
	


	public String getQueryWhere() {
		return queryWhere;
	}
	public void setQueryWhere(String queryWhere) {
		this.queryWhere = queryWhere;
	}
	/**
	 * 邮件设置列表
	 * @return
	 */
	public String emailSetList(){
		CreatQueryCondition creatQueryCondition = new CreatQueryCondition();// 条件查询类
		creatQueryCondition.initializtion(ServletActionContext.getRequest());// 初始化查询条件
		pm=this.emailServiceImpl.findEmeilSetList(creatQueryCondition.getHqlWhere(), SysParameter.CURRENT_YEAR);
		this.setQueryWhere(creatQueryCondition.getCondition());
		this.setYear(SysParameter.CURRENT_YEAR);
		return this.SUCCESS;
	}
	  public String saveEmailSet(){
		   this.getEmailServiceImpl().saveOrUpdate(emailSet);
		   return this.SUCCESS;
	   }
	  public String viewEmailSet(){
		  emailSet= this.getEmailServiceImpl().findEmeilSetById(emailSetId);
		   return this.SUCCESS;
	   }
    public TblEmailset getEmailSet() {
		return emailSet;
	}
	public void setEmailSet(TblEmailset emailSet) {
		this.emailSet = emailSet;
	}

	public IEmailService getEmailServiceImpl() {
		return emailServiceImpl;
	}

	public void setEmailServiceImpl(IEmailService emailServiceImpl) {
		this.emailServiceImpl = emailServiceImpl;
	}

	public IBasicInfoService getBasicInfoService() {
		return basicInfoService;
	}

	public void setBasicInfoService(IBasicInfoService basicInfoService) {
		this.basicInfoService = basicInfoService;
	}

	public IStaticDataService getStaticDateService() {
		return staticDateService;
	}

	public void setStaticDateService(IStaticDataService staticDateService) {
		this.staticDateService = staticDateService;
	}

	public Integer getEmailSetId() {
		return emailSetId;
	}
	public void setEmailSetId(Integer emailSetId) {
		this.emailSetId = emailSetId;
	}
	public PagerModel getPm() {
		return pm;
	}
	public void setPm(PagerModel pm) {
		this.pm = pm;
	}
	public String getYear() {
		return year;
	}
	public void setYear(String year) {
		this.year = year;
	}

}
